/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Relatorios;

import java.sql.Connection;
import java.util.HashMap;

import javax.swing.JOptionPane;

import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;

/**
 *
 * @author Fabio
 */
public class RepositorioCliente {

    public JasperPrint gerar() throws ExcRepositorio{
		JasperPrint rel = null;
		try {
			Connection con = gConexao.getConexao();
			HashMap map = new HashMap();
			String arquivoJasper = "Clientes.jasper";
			rel = JasperFillManager.fillReport(arquivoJasper, map, con);
                        JasperExportManager.exportReportToPdfFile(rel, "cliente.pdf");
		} catch (JRException e) {
                    e.printStackTrace();
			JOptionPane.showMessageDialog(null,e.getMessage());
		}
		return rel;
	}

}
